import { type postOrPutType } from "@/constants";
import type { IResult } from "@/types/common";
import { getAxios, commonAxios } from "@/utils/request.ts";

const url = "/back/login";
/* 登录获取token */
export const postLogin = <T, D>(params: D, type: postOrPutType): Promise<IResult<T>> => {
  return commonAxios<T, D>(url + "/login", params, type);
};
/* 刷新token */
export const postRefreshToken = <T, D>(params: D): Promise<IResult<T>> => {
  return commonAxios<T, D>(url + "/refresh-login", params, "POST");
};

/* 获取验证码 */
export const getMobileSmsCodeInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return getAxios<T, D>(url + "/get-mobile-sms-code", params);
};
